import nltk
from 翻译对比评分.读取xml文件特定信息 import data_from_xml, meteor_score_fenci
from nltk.translate.meteor_score import meteor_score

if __name__ == '__main__':
    nltk.download('wordnet')
    # 参考文件地址
    reference_file_path = '/Users/admin/Downloads/Pica2.3/values-pt-rBR/pica2.3requirement_pt.xml'
    # 机器翻译生成文件地址
    generated_file_path = '/Users/admin/Downloads/xmlContainer-pt.xml'
    generated_file_path2 = '/Users/admin/Downloads/xmlContainer-pt2.xml'

    # 从 xml 文件中获取参考数据,这里输出的是列表 []
    reference_translations = [[i] for i in data_from_xml(reference_file_path)]

    # 从 xml 文件中获取机器翻译生成数据,这里输出的也是 列表
    candidate_translations = [i for i in data_from_xml(generated_file_path2)]
    meteor_score_fenci(candidate_translations, reference_translations)
